import org.molamil.acto.pages.AbstractMovieContext;
import org.molamil.commons.StringUtil;

/**
 * Holds context and configuration for a Page.
 *
 * @author Jorge Hernandez
 */
class org.molamil.acto.pages.PageContext extends AbstractMovieContext {
	
	
	// Properties
	
	private var _role:String;
	private var _alias:String;	private var _redirect:String;
	private var _parentName:String;
	private var _parent:PageContext;
	private var _children:Array;
	private var _level:Number;
	
	
	// Constructor
	
	public function PageContext() {
		_children = new Array();
		_level = 0;
	}
	
	
	// Functions
	
	public function toString():String {
		var s:String = StringUtil.replace(super.toString(), "AbstractMovieContext", "PageContext") +
					   "\n\t role = " + _role +
					   "\n\t alias = " + _alias +					   "\n\t redirect = " + _redirect +
					   "\n\t parentName = " + _parentName +
					   "\n\t parent = " + _parent +
					   "\n\t children = [OMMITED]" +
					   "\n\t level = " + _level;
		return s;
	}
	
	
	// Getter/Setter
	
	/**
	 * Required role to access the page.
	 */
	public function get role():String {
		return _role;
	}
	
	public function set role(role:String):Void {
		this._role = role;
	}
	
	/**
	 * XXX: Document.
	 */
	public function get alias():String {
		return _alias;
	}
	
	public function set alias(alias:String):Void {
		this._alias = alias;
	}
	
	/**
	 * XXX: Document.
	 */
	public function get redirect():String {
		return _redirect;
	}
	
	public function set redirect(redirect:String):Void {
		this._redirect = redirect;
	}
	
	/**
	 * Parent page name.
	 */
	public function get parentName():String {
		return _parentName;
	}
	
	public function set parentName(parentName:String):Void {
		this._parentName = parentName;
	}
	
	/**
	 * Parent page.
	 */
	public function get parent():PageContext {
		return _parent;
	}
	
	public function set parent(parent:PageContext):Void {
		this._parent = parent;
	}
	
	/**
	 * Children pages.
	 */
	public function get children():Array {
		return _children;
	}
	
	public function set children(children:Array):Void {
		this._children = children;
	}
	
	/**
	 * Hierachy level, starting at 0.
	 */
	public function get level():Number {
		return _level;
	}
	
	public function set level(level:Number):Void {
		this._level = level;
	}
	
	
}